home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 June: Reference Library / Dev.CD Jun 99 RL Disk 1.toast / Technical Documentation / Develop / develop Issue 28 / develop Issue 28 code / MacApp Debugging / TwistDownLists / UTwistDownElement.h < prev    next >
Encoding:
Text File  |  1996-07-15  |  6.4 KB  |  136 lines  |  [TEXT/MPS ]

  1. //----------------------------------------------------------------------------------------
  2. // UTwistDownElement.h
  3. // ETO20 MacApp 3.3.1, MPW 3.4.1
  4. // Copyright ©1995-1996 Conrad Kopala
  5. // Twist Down Lists version 2.0a0 7/15/96
  6. //----------------------------------------------------------------------------------------
  7.  
  8. #ifndef __UTWISTDOWNELEMENT__
  9. #define __UTWISTDOWNELEMENT__
  10.  
  11. //MacApp stuff
  12. #ifndef __UOBJECT__
  13. #include "UObject.h"
  14. #endif
  15.  
  16. //ToolBox stuff
  17. //None
  18.  
  19. //ANSI stuff
  20. //None
  21.  
  22. //----------------------------------------------------------------------------------------
  23. // Constants
  24. //----------------------------------------------------------------------------------------
  25.  
  26. //----------------------------------------------------------------------------------------
  27. // Externals
  28. //----------------------------------------------------------------------------------------
  29. class TTwistDownControl;        //external
  30. class TTwistDownDocument;        //external
  31. //----------------------------------------------------------------------------------------
  32. // TTwistDownElement
  33. //----------------------------------------------------------------------------------------
  34.  
  35. class TTwistDownElement: public TObject, public MScriptableObject
  36. {
  37.     MA_DECLARE_CLASS;
  38.     
  39. public:
  40. TTwistDownDocument*        fTwistDownDocument;    //Needed for GetObjectsContainer()
  41. TTwistDownElement*        fSuccessorElement;    //A NULL value terminates this portion of the chain.
  42. TTwistDownElement*        fDescendantElement; //For files, fDescendantElement is always NULL. For empty folders,
  43.                                                                                     //fDescendantElement == NULL otherwise, fDescendantElement != NULL.
  44.  
  45. long                                    fItemInList;        //This identifies the position of the element in the list.                                                    
  46.                                                                             //The position in the list is established in 
  47.                                                                             //TTwistDownDocument::MakeTwistDownElement. After that
  48.                                                                             //it never changes. Note that its position in the list
  49.                                                                             //differs from its rowNumber in TTwistDownView as only
  50.                                                                             //a portion of the list is displayed unless the list 
  51.                                                                             //has been completely expanded. Originally used only for 
  52.                                                                             //finding  your mistakes (debugging, for those who don't 
  53.                                                                             //make mistakes.)
  54.                                                                             
  55.  
  56. short                                    fIndentLevel;        //This is establised in TTwistDownDocument::MakeTwistDownElement.
  57.                                                                             //After that, it never changes.
  58.                                                                             
  59. Boolean                                fHasSubList;        //This is set in TTwistDownDocument::BuildTwistDownList.
  60.                                                                             //Once set, it is never cleared. If fHasSubList == TRUE,
  61.                                                                             //fDescendantElement will not be NULL unless the folder is empty.
  62.                                                                             //It might more appropriately be called fIsFolder.
  63.                                                                             
  64. Boolean                                fShowSubList;        //Set and cleared as required but only if fHasSubList == TRUE.
  65.                                                                             //If fHasSubList == FALSE, fShowSubList is never set and never
  66.                                                                             //cleared. If fShowSubList == TRUE, the twistDownTriangle points
  67.                                                                             //down and the descendant elements beginning with fDescendantElement
  68.                                                                             //are shown. In the case of an empty folder, fShowSubList can be
  69.                                                                             //TRUE with the twistDownTriangle pointing down to show that
  70.                                                                             //there is nothing in it. It might more appropriately be called
  71.                                                                             //fShowFolderContents.
  72.  
  73. Boolean                                fOldShowSubList;    //This is here to support error recovery in out of memory situations.
  74.                                                                                 //When expanding the whole list, and the out of memory condition is 
  75.                                                                                 //encountered, we need to recover. This is done by 'un-expanding'
  76.                                                                                 //the list. To successfully accomplish that, it is necessary to
  77.                                                                                 //remember the value of the fShowSubList flag so that it can be
  78.                                                                                 //restored to its old value. The old value is kept in fOldShowSubList.
  79.  
  80. CStr63                                fDisplayedText;    //The name of the folder or file as the case may be.
  81.  
  82. TTwistDownControl*        fTwistDownControl;    //Its twistDownControl, if any. Only those twistDownElements
  83.                                                                                     //for which fHasSubList == TRUE can ever have a
  84.                                                                                     //twistDownControl.
  85.  
  86. TTwistDownElement::TTwistDownElement();
  87. virtual ~TTwistDownElement();
  88.  
  89. void TTwistDownElement::ITwistDownElement(TTwistDownDocument* twistDownDocument, short indentLevel, 
  90.                                                                                     CStr63 displayedText);
  91.  
  92. void TTwistDownElement::GetDisplayedText(CStr63& theDisplayedText);
  93.  
  94. void TTwistDownElement::SetHasSubListFlag();
  95. void TTwistDownElement::ClearHasSubListFlag();    //Is never used. Included for completeness.
  96. Boolean TTwistDownElement::TestHasSubListFlag();
  97.  
  98. void TTwistDownElement::SetShowSubListFlag();
  99. void TTwistDownElement::ClearShowSubListFlag();
  100. void TTwistDownElement::RestoreShowSubListFlag();
  101. Boolean TTwistDownElement::TestShowSubListFlag();
  102.  
  103. void TTwistDownElement::SetOldShowSubListFlag();
  104. void TTwistDownElement::ClearOldShowSubListFlag();
  105. Boolean TTwistDownElement::TestOldShowSubListFlag();
  106.  
  107. void TTwistDownElement::SetSuccessorElementTo(TTwistDownElement* theSuccessorElement);
  108. void TTwistDownElement::SetDescendantElementTo(TTwistDownElement* theDescendantElement);
  109. TTwistDownElement*    TTwistDownElement::GetSuccessorElement();
  110. TTwistDownElement*    TTwistDownElement::GetDescendantElement();
  111.  
  112. void TTwistDownElement::SetTwistDownControlTo(TTwistDownControl* theTwistDownControl);
  113. TTwistDownControl*    TTwistDownElement::GetTwistDownControl();
  114.  
  115. void TTwistDownElement::SetIndentLevel(short indentLevel);    //is not being used, included for completeness.
  116. short TTwistDownElement::GetIndentLevel();
  117.  
  118. void TTwistDownElement::SetItemInList(long itemInList);
  119. long TTwistDownElement::GetItemInList();
  120.  
  121. Boolean TTwistDownElement::CouldExpandElement();    //Tests to make sure the capacity of TTwistDownView
  122.                                                                                                     //(TTextListView) will not be exceeded by an attempt
  123.                                                                                                     //to expand the element.
  124.  
  125. // Scripting support
  126. virtual void TTwistDownElement::DoScriptCommand(CommandNumber aCommandNumber, TAppleEvent* message, 
  127.                                                                                                 TAppleEvent* reply);
  128.                                                                                                 
  129. virtual DescType TTwistDownElement::GetSpecifierForm();
  130. virtual Boolean TTwistDownElement::GetObjectProperty(CAEDesc& thePropertyValue,DescType whichProperty,
  131.                                                                                     const CAEDesc& desiredType);
  132.                                                                                     
  133. virtual MScriptableObject* TTwistDownElement::GetObjectsContainer();
  134.  
  135. };
  136. #endif